package com.os.register.service.impl;

import com.os.register.dao.RegisterMapper;
import com.os.register.bean.Register;
import com.os.register.service.RegisterService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import java.util.List;

/**
 * @author 
 * @version v1.0.0
 * @description Register 实现类
 * @date Created in 2018-08-27 18:34:07
 */
@Service
@Transactional
public class RegisterServiceImpl implements RegisterService {

    private static final Logger LOGGER = LoggerFactory.getLogger(RegisterServiceImpl.class);

    @Resource
    private RegisterMapper registerMapper;

    /**
     * 通过ID查找对象
     * @param registerId
     * @return
     */
    @Override
    public Register getById(Integer registerId) throws Exception {
        return this.registerMapper.getById(registerId);
    }

    /**
     * 列表
     * @param
     * @return
     */
    @Override
    public List<Register> list(Register register) throws Exception {
		List<Register> list = registerMapper.list(register);
		return list;
	}

    /**
     * 删除
     * @param registerId
     * @return
     */
	@Override
	public int deleteById(Integer registerId) throws Exception {
		registerMapper.deleteById(registerId);
		return 1;
	}

    /**
     * 保存
     * @param register
     * @return
     */
	@Override
	public Register save(Register register) throws Exception {
		try {
            registerMapper.save(register);
		}catch (Exception e){
			e.printStackTrace();
		}
		return register;
	}

    /**
     * 更新
     * @param register
     * @return
     */
	@Override
	public Register update(Register register) throws Exception {
		try {
            registerMapper.update(register);
		}catch (Exception e){
			e.printStackTrace();
		}
		return register;
	}



}
